GBML manual / Collision

tile_clear_auto

Empties the square at (x, y) if it is a square of the autotile `set`, and the eight squares around it look again and take the piece that fits now. The undo of tile_set_auto.

Works differently on Game Boy - Autotiles pick their pieces as on the Advance, with smaller limits: an autotile only works in a room painted from its own tileset, the game keeps at most 48 changed squares of a room at once, and the collision setting goes to the squares the call changes.

Works differently on Game Boy Color - Autotiles work as on the Advance, steep slopes and variant groups too. A room keeps at most 48 changed squares (64 with slope, face or 47-piece sets, 236 with depth layers); with depth layers a big change takes up to 3.5 s (8 s on the Game Boy) to settle.

Sega Genesis: not built yet

On other consoles this differs: see Side by side and How the consoles differ.

Syntax

tile_clear_auto(x, y, set)

Arguments

NameType
xreal
yreal
setint

Returns

Nothing.

Description

Empties the square at (x, y) if it is a square of the autotile set, and the eight squares around it look again and take the piece that fits now. It is the undo of tile_set_auto: dig the square out of a pond and the squares around the hole get their edges and inner corners.

A square that is not one of that autotile's squares is left exactly as it is. An emptied square becomes the empty tile (square 0 of the picture, which shows nothing) and - if the autotile has a collision setting - it stops blocking.

x and y are a place in the room from its top-left corner, as for tile_set_index. It does nothing where tile_set_index does nothing, and the change is not saved and does not survive a room change.

Example

tile_clear_auto(x, y + 8, AUTOTILE_GRASS);

Digs the square below the walker out of the grass. If it was not grass, nothing happens.

On the GBA

A square that is not a square of that autotile is left alone. An emptied square gets the empty tile and, if the autotile has a collision setting, becomes passable again. Same limits as tile_set_auto.

See also: tile_set_autoAutotiletile_set_indextile_index